package ge.unihack.instantdj.protocol.server;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class ClientWrapper extends Client {

	private Client originalClient;
	private InputStream in;
	private OutputStream out;
	private Socket sock;

	public ClientWrapper(Client original, Socket socket) throws IOException {
		originalClient = original;
		sock = socket;
		this.in = sock.getInputStream();
		this.out = socket.getOutputStream();
	}

	@Override
	public int getId() {
		return originalClient.getId();
	}

	public InputStream getIn() {
		return in;
	}

	public OutputStream getOut() {
		return out;
	}
	
	public void close() {
		if (sock != null) {
			try {
				sock.close();
			} catch (IOException e) {
			}
			sock = null;
		}
	}

}
